﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta charset="utf-8">
    <title>Add</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="~/Areas/Back/css/x-admin.css" media="all">

</head>
<body>
    <form class="layui-form" id="frmAdd">
        <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
        <div class="layui-form-item">
            <label class="layui-form-label">资源</label>
            <div class="layui-input-inline ">
                <input type="text" name="ArticleId" id="ArticleId" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">位置</label>
            <div class="layui-input-inline ">
                <input type="text" name="PosId" id="PosId" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">权重</label>
            <div class="layui-input-inline ">
                <input type="text" name="Weight" id="Weight" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="*">保存</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
        <!-- 更多表单结构排版请移步文档左侧【页面元素-表单】一项阅览 -->
    </form>
    <script src="~/Areas/Back/lib/layui/layui.js" charset="utf-8"></script>
    <script src="~/Areas/Back/js/x-layui.js" charset="utf-8"></script>
    <script>

layui.use(['form','layer'], function(){
    var form = layui.form;
    var layer = layui.layer;
    var $ = layui.$;

    //各种基于事件的操作，下面会有进一步介绍
    form.on('submit(*)', function (data) {
        var str = $("#frmAdd").serialize();
        $.post("/Back/ReCommend/SaveTui", str, function (re) {
            if (re > 0) {
                layer.msg("添加成功");
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);//关闭父窗口
                parent.location.reload(); //刷新父页面
                obj.del(); //删除对应行（tr）的DOM结构，并更新缓存
            } else {
                layer.msg("添加失败");
            }
        }, "text");
        return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
    });

});
    </script>
</body>
</html>